package com.spzx.test.t2;

public class Tree {

    Integer apple = 999;


    public synchronized void get(){
        if(apple>0){
            apple--;
            System.out.println(Thread.currentThread().getName()+"摘走一颗苹果,剩余苹果数量"+apple);
        }else {
            System.out.println(Thread.currentThread().getName()+"苹果摘完了："+apple);

        }

    }

}
